package com.itheima.day04_api;

import java.util.Random;

public class yanZhengMa {
    public static void main(String[] args) {
        String code = getCode();
        System.out.println(code);
    }
    public static String getCode() {
        Random rng = new Random();
        StringBuilder sb = new StringBuilder();
        for (char i = 'a'; i <= 'z'; i++) {
            sb.append(i);
        }
        for (char i = 'A'; i <= 'Z'; i++) {
            sb.append(i);
        }
        for (int i = 0; i <= 9; i++) {
            sb.append(i);
        }
        int index = 0;
        StringBuilder yzm = new StringBuilder();
        for(int i = 0; i<4 ;i++){
            index = rng.nextInt(0,sb.length());
            yzm.append(sb.charAt(index));
        }
        String s = yzm.toString();
        return s;

    }
}

